package com.bjx.api.flow.service;

import com.bjx.api.flow.domain.vo.FlowNodeVO;
import com.bjx.api.flow.domain.vo.FlowStartVO;
import com.bjx.api.flow.service.fallback.RemoteFlowFallBack;
import com.bjx.common.core.constant.ServiceNameConst;
import com.bjx.common.core.domain.R;
import com.bjx.common.security.interceptor.FeignInterceptor;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @desc: 远程流程接口
 * @author: liushuai
 * @date: 2022/11/1 16:39
 */
@FeignClient(name = ServiceNameConst.FLOW,fallback = RemoteFlowFallBack.class,path = "/base",configuration = FeignInterceptor.class)
public interface RemoteFlowService {

    /**
     * 启动流程
     * @param flowStartVO
     * @return: com.bjx.common.core.domain.R
     * @Author: liushuai
     * @Date: 2022/11/1 16:41
     */
    @PostMapping("/startFlow")
    R<String> startFlow(@RequestBody FlowStartVO flowStartVO);

    /**
     * 根据流程定义id查询流程第一个用户审批节点信息
     * @param definitionId
     * @return: com.bjx.common.core.domain.R<com.bjx.api.flow.domain.vo.FlowNodeVO>
     * @Author: liushuai
     * @Date: 2022/12/5 20:08
     */
    @GetMapping("/selectFirstFlowNodeInfoByDefinitionId")
    R<FlowNodeVO> selectFirstFlowNodeInfoByDefinitionId(@RequestParam("definitionId") String definitionId);

    /**
     * 根据流程定义Key获取第一个流程审批节点
     * @param definitionKey
     * @return: com.bjx.common.core.domain.R<com.bjx.api.flow.domain.vo.FlowNodeVO>
     * @Author: liushuai
     * @Date: 2023/1/10 10:59
     */
    @GetMapping("/selectFirstFlowNodeInfoByDefinitionKey")
    R<FlowNodeVO> selectFirstFlowNodeInfoByDefinitionKey(@RequestParam("definitionKey") String definitionKey);
}
